<?php
	//
	//Supprime un dossier et son contenu
	//
	function rmdir_r($dossier, $output=true){
		$exceptions = array('.','..');
		$sourcedir = opendir($dossier);
		while(false !== ($filename = readdir($sourcedir))){
			if(!in_array($filename, $exceptions)){
				if($output){
					echo "Processing: ".$dossier.DIRECTORY_SEPARATOR.$filename."<br>";
				}
				if(is_dir($dossier.DIRECTORY_SEPARATOR.$filename)){
					// recurse subdirectory; call of function recursive
					rmdir_r($dossier.DIRECTORY_SEPARATOR.$filename);
				}else if(is_file($dossier.DIRECTORY_SEPARATOR.$filename)){
					// unlink file
					unlink($dossier.DIRECTORY_SEPARATOR.$filename);
				}
			}
		}
		closedir($sourcedir);
		return rmdir($dossier) ? true : false;
	}
	//
?>